clear all;

load smthResults.mat

techinv0 = [fossilmat0(:,9);renewmat0(:,8)];
techinv1 = [fossilmat1(:,9);renewmat1(:,8)];
techinv2 = [fossilmat2(:,9);renewmat2(:,8)];
techinv3 = [fossilmat3(:,9);renewmat3(:,8)];

% wholemat = [k,c,inv,lambda,PR Penergy]
%             1 2 3      4    5    6
% renewmat = [kr cr ir lambdar PRr P_Er Hr jr eta]
%              1  2  3  4       5    6  7  8   9
% fossilmat = [kf cf invf lambdaf PRf P_Ef Sf Nf nf gf sigmaf];
%              1   2   3     4     5   6    7  8  9 10   11

figure(1)

subplot(2,2,1)
plot (1:Tmat0(1)+1,wholemat0(:,1),'k');
xlabel('year t')
ylabel('capital k')
title('(a)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,1),'b');
plot (1:Tmat2(1)+1,wholemat2(:,1),'r');
plot (1:Tmat3(1)+1,wholemat3(:,1),'c');
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthWest','FontSize',8)
% xlim([80, 120])
hold off


subplot(2,2,2)
plot (1:Tmat0(1)+1,wholemat0(:,2),'k');
title('(b)')
xlabel('year t')
ylabel('consumption c')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,2),'b');
plot (1:Tmat2(1)+1,wholemat2(:,2),'r');
plot (1:Tmat3(1)+1,wholemat3(:,2),'c');
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
% xlim([80, 120]);
hold off

subplot(2,2,3) 
plot (1:Tmat0(1)+1,wholemat0(:,3),'k');
title('(c)')
hold on;
plot (1:Tmat1(1)+1,wholemat1(:,3),'b');
plot (1:Tmat2(1)+1,wholemat2(:,3),'r');
plot (1:Tmat3(1)+1,wholemat3(:,3),'c');
% xlim([80, 120])
xlabel('year t')
ylabel('investment i')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,4)
plot (1:Tmat0(1)+1,wholemat0(:,4)/wholemat1(1,4),'k');
title('(d)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,4)/wholemat1(1,4),'b');
plot (1:Tmat2(1)+1,wholemat2(:,4)/wholemat2(1,4),'r');
plot (1:Tmat3(1)+1,wholemat3(:,4)/wholemat3(1,4),'c');
% xlim([80, 120])
xlabel('year t')
ylabel('good price p')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthEast','FontSize',8)
hold off
print -r600 -depsc ./ch2/full

%% 
figure(8)

subplot(2,2,1) 
plot (1:Tmat0(1)+1,wholemat0(:,6),'k')
title('(f)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,6),'b')
plot (1:Tmat2(1)+1,wholemat2(:,6),'r')
plot (1:Tmat3(1)+1,wholemat3(:,6),'c')
% xlim([80, 120])
xlabel('year t')
ylabel('energy price')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthEast','FontSize',8)
hold off

subplot(2,2,2) 
plot (1:Tmat0(1)+1,wholemat0(:,2)./(0.2772*wholemat0(:,1)),'k');
title('(e)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,2)./(0.2772*wholemat1(:,1)),'b');
plot (1:Tmat2(1)+1,wholemat2(:,2)./(0.2772*wholemat2(:,1)),'r');
plot (1:Tmat3(1)+1,wholemat3(:,2)./(0.2772*wholemat3(:,1)),'c');
% xlim([80, 120])
xlabel('year t')
ylabel('consumption c/output Ak')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthEast','FontSize',8)
hold off

subplot(2,2,3) 
plot (1:Tmat0(1)+1,wholemat0(:,3)./(0.2772*wholemat0(:,1)),'k');
title('(e)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,3)./(0.2772*wholemat1(:,1)),'b');
plot (1:Tmat2(1)+1,wholemat2(:,3)./(0.2772*wholemat2(:,1)),'r');
plot (1:Tmat3(1)+1,wholemat3(:,3)./(0.2772*wholemat3(:,1)),'c');
% xlim([80, 120])
xlabel('year t')
ylabel('investment i/output Ak')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthEast','FontSize',8)
hold off

subplot(2,2,4) 
plot (1:Tmat0(1)+1,(wholemat0(:,3)+techinv0)./(0.2772*wholemat0(:,1)),'k');
title('(e)')
hold on
plot (1:Tmat1(1)+1,(wholemat1(:,3)+techinv1)./(0.2772*wholemat1(:,1)),'b');
plot (1:Tmat2(1)+1,(wholemat2(:,3)+techinv2)./(0.2772*wholemat2(:,1)),'r');
plot (1:Tmat3(1)+1,(wholemat3(:,3)+techinv3)./(0.2772*wholemat3(:,1)),'c');
% xlim([80, 120])
xlabel('year t')
ylabel('investment (i+n+j)/output Ak')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthEast','FontSize',8)
hold off

print -r600 -depsc ./ch2/full_P

%%
figure(9)

subplot(2,3,1)
plot (1:Tmat0(1)+1,wholemat0(:,1),'k');
xlabel('year t')
ylabel('capital k')
title('(a)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,1),'b');
plot (1:Tmat2(1)+1,wholemat2(:,1),'r');
plot (1:Tmat3(1)+1,wholemat3(:,1),'c');
xlim([80, 120])
hold off


subplot(2,3,2)
plot (1:Tmat0(1)+1,wholemat0(:,2),'k');
title('(b)')
xlabel('year t')
ylabel('consumption c')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,2),'b');
plot (1:Tmat2(1)+1,wholemat2(:,2),'r');
plot (1:Tmat3(1)+1,wholemat3(:,2),'c');
xlim([80, 120]);
hold off

subplot(2,3,3) 
plot (1:Tmat0(1)+1,wholemat0(:,3),'k');
title('(c)')
hold on;
plot (1:Tmat1(1)+1,wholemat1(:,3),'b');
plot (1:Tmat2(1)+1,wholemat2(:,3),'r');
plot (1:Tmat3(1)+1,wholemat3(:,3),'c');
xlim([80, 120])
xlabel('year t')
ylabel('investment i')
hold off

subplot(2,3,4)
plot (1:Tmat0(1)+1,wholemat0(:,4)/wholemat1(1,4),'k');
title('(d)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,4)/wholemat1(1,4),'b');
plot (1:Tmat2(1)+1,wholemat2(:,4)/wholemat2(1,4),'r');
plot (1:Tmat3(1)+1,wholemat3(:,4)/wholemat3(1,4),'c');
xlim([80, 120])
xlabel('year t')
ylabel('good price p')
hold off

subplot(2,3,5) 
plot (1:Tmat0(1)+1,wholemat0(:,5),'k');
title('(e)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,5),'b');
plot (1:Tmat2(1)+1,wholemat2(:,5),'r');
plot (1:Tmat3(1)+1,wholemat3(:,5),'c');
xlim([80, 120])
xlabel('year t')
ylabel('price ratio')
hold off


subplot(2,3,6) 
plot (1:Tmat0(1)+1,wholemat0(:,6),'k')
title('(f)')
hold on
plot (1:Tmat1(1)+1,wholemat1(:,6),'b')
plot (1:Tmat2(1)+1,wholemat2(:,6),'r')
plot (1:Tmat3(1)+1,wholemat3(:,6),'c')
xlim([80, 120])
xlabel('year t')
ylabel('energy price')
hold off
print -r600 -depsc ./ch2/full_detail
%%
figure(2)
subplot(2,2,1)
semilogy (1:Tmat0(1)+1,wholemat0(:,1),'k');
title('(a)')
hold on
semilogy (1:Tmat1(1)+1,wholemat1(:,1),'b');
semilogy (1:Tmat2(1)+1,wholemat2(:,1),'r');
semilogy (1:Tmat3(1)+1,wholemat3(:,1),'c');
xlabel('year t')
ylabel('capital k')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','SouthEast','FontSize',8)
hold off

subplot(2,2,2)
semilogy (1:Tmat0(1)+1,wholemat0(:,2),'k')
title('(b)')
xlabel('year t')
ylabel('consumption c')
hold on
semilogy (1:Tmat1(1)+1,wholemat1(:,2),'b')
semilogy (1:Tmat2(1)+1,wholemat2(:,2),'r')
semilogy (1:Tmat3(1)+1,wholemat3(:,2),'c')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','SouthEast','FontSize',8)
hold off

subplot(2,2,3) 
semilogy (1:Tmat0(1)+1,wholemat0(:,3),'k')
title('(c)')
hold on
semilogy (1:Tmat1(1)+1,wholemat1(:,3),'b')
semilogy (1:Tmat2(1)+1,wholemat2(:,3),'r')
semilogy (1:Tmat3(1)+1,wholemat3(:,3),'c')
xlabel('year t')
ylabel('investment i')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','SouthEast','FontSize',8)
hold off

subplot(2,2,4)
semilogy (1:Tmat0(1)+1,wholemat0(:,4)/wholemat0(1,4),'k')
title('(d)')
hold on
semilogy (1:Tmat1(1)+1,wholemat1(:,4)/wholemat1(1,4),'b')
semilogy (1:Tmat2(1)+1,wholemat2(:,4)/wholemat2(1,4),'r')
semilogy (1:Tmat3(1)+1,wholemat3(:,4)/wholemat3(1,4),'c')
xlabel('year t')
ylabel('good price p')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthEast','FontSize',8)
hold off
print -r600 -depsc ./ch2/full_log

%%
figure(3)
subplot(2,2,1)
plot (1:Tmat0(2)+1,fossilmat0(:,1),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,1),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,1),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,1),'c')
title('(a)')
xlabel('year')
ylabel('capital stock k')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,2)
plot (1:Tmat0(2)+1,fossilmat0(:,2),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,2),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,2),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,2),'c')
title('(b)')
xlabel('year')
ylabel('consumption c')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','SouthEast','FontSize',8)
hold off

subplot(2,2,3) 
plot (1:Tmat0(2)+1,fossilmat0(:,3),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,3),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,3),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,3),'c')
title('(c)')
xlabel('year')
ylabel('investment i')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,4) 
plot (1:Tmat0(2)+1,fossilmat0(:,9),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,9),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,9),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,9),'c')
title('(d)')
xlabel('year')
ylabel('R&D investment n')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

print -r600 -depsc ./ch2/fossil1

%%
figure(4)
subplot(2,2,1)
plot (1:Tmat0(2)+1,fossilmat0(:,7),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,7),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,7),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,7),'c')
title('(a)')
xlabel('year')
ylabel('cumulative production S')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthWest','FontSize',8)
hold off

% subplot(2,2,2)
% plot (1:Tmat0(2)+1,fossilmat0(:,8),'k')
% hold on
% plot (1:Tmat1(2)+1,fossilmat1(:,8),'b')
% plot (1:Tmat2(2)+1,fossilmat2(:,8),'r')
% plot (1:Tmat3(2)+1,fossilmat3(:,8),'c')
% title('(b)')
% xlabel('year')
% ylabel('technological progress N')
% % leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% % set(leg1,'Location','NorthWest','FontSize',8)
% hold off
subplot(2,2,2)
plot (1:Tmat0(2)+1,-fossilmat0(:,11)./fossilmat0(:,4),'k')
hold on
plot (1:Tmat1(2)+1,-fossilmat1(:,11)./fossilmat1(:,4),'b')
plot (1:Tmat2(2)+1,-fossilmat2(:,11)./fossilmat2(:,4),'r')
plot (1:Tmat3(2)+1,-fossilmat3(:,11)./fossilmat3(:,4),'c')
title('(b)')
xlabel('year')
ylabel('extraction permit price f')

subplot(2,2,3) 
plot (1:Tmat0(2)+1,fossilmat0(:,10),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,10),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,10),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,10),'c')
title('(c)')
xlabel('year')
ylabel('marginal extraction cost g')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,4) 
plot (1:Tmat0(2)+1,fossilmat0(:,6),'k')
hold on
plot (1:Tmat1(2)+1,fossilmat1(:,6),'b')
plot (1:Tmat2(2)+1,fossilmat2(:,6),'r')
plot (1:Tmat3(2)+1,fossilmat3(:,6),'c')
title('(d)')
xlabel('year')
ylabel('energy price p^R')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

print -r600 -depsc ./ch2/fossil2

%%
figure(5)
subplot(2,2,1)
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,1),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,1),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,1),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,1),'c')
title('(a)')
xlabel('year')
ylabel('capital k')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,2)
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,2),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,2),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,2),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,2),'c')
title('(b)')
xlabel('year')
ylabel('consumption c')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off

subplot(2,2,3) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,3),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,3),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,3),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,3),'c')
title('(c)')
xlabel('year')
ylabel('investment i')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off


subplot(2,2,4) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,8),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,8),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,8),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,8),'c')
title('(d)')
xlabel('year')
ylabel('R&D investment j')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
hold off
print -r600 -depsc ./ch2/renew1
%%
figure(6)
% subplot(2,2,1)
% plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,5),'k')
% hold on
% plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,5),'b')
% plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,5),'r')
% plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,5),'c')
% % xlim([0,3])
% title('(a)')
% xlabel('year')
% ylabel('good price ratio')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthEast','FontSize',8)
% hold off
subplot(2,2,1) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,4),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,4),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,4),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,4),'c')
title('(a)')
xlabel('year')
ylabel('good price p')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthEast','FontSize',8)
hold off

subplot(2,2,2)
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,6),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,6),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,6),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,6),'c')
% xlim([0,3])
title('(b)')
xlabel('year')
ylabel('energy price p^B')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthEast','FontSize',8)
hold off

subplot(2,2,3) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,7),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,7),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,7),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,7),'c')
title('(c)')
xlabel('year')
ylabel('cumulative knowledge H')
leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
set(leg1,'Location','NorthWest','FontSize',8)
hold off
% subplot(2,2,3) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,9)/renewmat0(:,4),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),renewmat1(:,9)/renewmat1(:,4),'b')
plot (1:Tmat2(1)-Tmat2(2),renewmat2(:,9)/renewmat2(:,4),'r')
plot (1:Tmat3(1)-Tmat3(2),renewmat3(:,9)/renewmat3(:,4),'c')
% title('(a)')
% xlabel('year')
% ylabel('good price p')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthEast','FontSize',8)
% hold off

subplot(2,2,4) 
plot (1:Tmat0(1)-Tmat0(2),(26.0238+renewmat0(:,7)).^(-0.25) - renewmat0(:,6),'k')
hold on
plot (1:Tmat1(1)-Tmat1(2),(26.0238+renewmat1(:,7)).^(-0.25) - renewmat1(:,6),'b')
plot (1:Tmat2(1)-Tmat2(2),(26.0238+renewmat2(:,7)).^(-0.25) - renewmat2(:,6),'r')
plot (1:Tmat3(1)-Tmat3(2),(26.0238+renewmat3(:,7)).^(-0.25) - renewmat3(:,6),'c')
title('(d)')
xlabel('year')
ylabel('learning contribution m-p^B')
hold off

print -r600 -depsc ./ch2/renew2

%%
figure(7)
subplot(1,1,1)
plot (1:Tmat0(2)+1,-fossilmat0(:,11)./fossilmat0(:,4),'k')
hold on
plot (1:Tmat1(2)+1,-fossilmat1(:,11)./fossilmat1(:,4),'b')
plot (1:Tmat2(2)+1,-fossilmat2(:,11)./fossilmat2(:,4),'r')
plot (1:Tmat3(2)+1,-fossilmat3(:,11)./fossilmat3(:,4),'c')
axis tight
xlabel('year')
ylabel('fossil fuel extraction permit price f_t')
% leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% set(leg1,'Location','NorthWest','FontSize',8)
% 
% subplot(2,1,2)
% plot (1:Tmat0(2),fossilmat0(1:end-1,10),'k');
% hold on
% plot (1:Tmat1(2),fossilmat1(1:end-1,10),'b')
% plot (1:Tmat2(2),fossilmat2(1:end-1,10),'r')
% plot (1:Tmat3(2),fossilmat3(1:end-1,10),'c')
% xlabel('year')
% ylabel('shape of cost g before T0')
% % leg1 = legend('\rho = \theta = 0','\rho = 0.05\psi, \theta = 0.95\psi','\rho = 0.25\psi, \theta = 0.75\psi','\rho = 0.95\psi, \theta = 0.05\psi');
% % set(leg1,'Location','NorthWest','FontSize',8)


